package com.zhentao.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.domain.SClass;
import com.zhentao.domain.dto.HomePageInfo;
import com.zhentao.domain.dto.SClassStudents;
import com.zhentao.mapper.SQuestionMapper;
import com.zhentao.mapper.STestPaperMapper;
import com.zhentao.mapper.TUserMapper;
import com.zhentao.result.Result;
import com.zhentao.service.SClassService;
import com.zhentao.mapper.SClassMapper;
import com.zhentao.service.SExaminationInformationService;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author 86150
* @description 针对表【s_class】的数据库操作Service实现
* @createDate 2024-07-29 21:21:28
*/
@Service
public class SClassServiceImpl extends ServiceImpl<SClassMapper, SClass>
    implements SClassService{

    @Resource
    private SClassMapper sClassMapper;

    @Resource
    private TUserMapper tUserMapper;

    @Resource
    private STestPaperMapper sTestPaperMapper;

    @Resource
    private SQuestionMapper questionMapper;

    @Resource
    private SExaminationInformationService examinationInformationService;

    @Override
    public Result getSClassStudentNum() {
        List<SClassStudents> list = sClassMapper.getSClassStudentNum();
        return Result.OK(list);
    }

    @Override
    public Result getAllNum() {
        Integer teacherNum=tUserMapper.getTeacherNum();
        Integer studentNum=tUserMapper.getStudentNum();
        Integer testNum=examinationInformationService.getTestNum();
        Integer questionNum=questionMapper.getQuestionNum();
        HomePageInfo homePageInfo = new HomePageInfo();
        homePageInfo.setTeacherNum(teacherNum);
        homePageInfo.setStudentNum(studentNum);
        homePageInfo.setPaperNum(testNum);
        homePageInfo.setQuestionNum(questionNum);
        return Result.OK(homePageInfo);
    }


}




